const axios = require('axios');
axios.defaults.baseURL='http://192.168.56.100:8080/zentao';
axios.defaults.headers={'Content-Type': 'application/json','Token':'501ee3223457921a10f8efb7f75d1bcb'};



// 封装成外部可用形式

module.exports={
    

//获取token
gettoken:async function gettoken(){

await  axios.post('/api.php/v1/tokens',
{"account": "admin", "password": "Use123"}).then(

    res=>{
        
        console.log(res.data);
    }
).catch(
    error=>{
        console.log(error)
    }
)


},

getuser:async function getuser(){
// axios.get('/api.php/v1/user',{headers:{'Content-Type': 'application/json','Token':'501ee3223457921a10f8efb7f75d1bcb'}}).then(



//获取自己的用户数据
await axios.get('/api.php/v1/user').then(

   // 获取返回数据
   res=>{

        console.log(res.data)
        
        }

).catch(
    error=>{
        console.log(error.response.data);
    }
)

},


}